<!--
 @description
 @fileName SkuItem.vue
 @author zengqiongying
 @created 2022/08/08 21:37:44
-->
<template>
  <div class="sku-item" @click="handleClickSku">
    <div class="sku-image">
      <ImageVideo :src="sku.mainPicUrl" fit="fill" />
    </div>
    <div class="sku-content">
      <div class="cell-con">
        <div class="name">{{ sku.skuName }}</div>
        <div class="tags">
          <template v-if="sku.productFlag==='05'">
            <span class="tag">样</span>
            <span class="tag">赠</span>
          </template>
          <span v-if="sku.productFlag==='02'" class="tag">样</span>
          <span v-if="sku.productFlag==='03'" class="tag">赠</span>
        </div>
      </div>
      <div>
        <div v-if="sku.returnQuantity" class="icon-return">已退{{ sku.returnQuantity || 0 }}件</div>
        <div class="cell-foot">
          <span v-if="sku.isActivity===1" class="icon-special-price" />
          <span v-if="sku.productFlag && ['03','05'].includes(sku.productFlag)" class="sale-price">0</span>
          <span v-else class="sale-price">{{ sku.salePrice || 0 }}</span>
          <span class="org-price">¥{{ sku.orangePrice || 0 }}</span>
          <span class="quantity">x{{ sku.quantity }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import ImageVideo from '@/components/ImageVideo'
export default {
  name: 'OrderSKuItem',
  components: { ImageVideo },
  props: {
    sku: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {

    }
  },
  methods: {
    handleClickSku() {
      const { spuId, skuId } = this.sku
      if (spuId && skuId) {
        this.$router.push({
          name: 'FinishedDetail',
          params: { spuId, skuId }
        })
      }
    }
  }
}

</script>
<style lang='less' scoped>
.sku-item{
  display: flex;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #EFF2F7;
  &:last-child{
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
  }
  .sku-image{
    width: 110px;
    height: 110px;
    overflow: hidden;
    border-radius: 6px;
    margin-right: 10px;
  }
  .sku-content{
    flex: 1;
    min-height: 110px;
    display: flex;
    justify-content: space-between;
    flex-direction:column;
    color: #333333;
    font-size: 14px;
    .name{
      margin-bottom: 6px;
      max-height: 40px;
      line-height: 20px;
      font-size: 14px;
      font-weight: bold;
      color: #333333;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      -webkit-line-clamp:2;
    }

    .tags{
      height: 20px;
      margin-top: 8px;
      .tag{
        display: inline-block;
        padding: 4px;
        line-height: 1;
        background: rgba(234, 91, 49, .1);
        border-radius: 6px;
        margin-right: 8px;
        color: #FF6345;
        font-size: 10px;
        text-align: center;
      }
    }
    .cell-foot{
      display: flex;
      align-items: baseline;
    }
    .icon-special-price{
      margin-right: 4px;
      width: 41px;
      height:16px;
      background: url(~@/assets/my/icon-special-price.png) no-repeat;
      background-size: 41px 16px;
    }
    .sale-price{
      margin-right:10px;
      font-size: 18px;
      color: #FD5001;
      font-weight: bold;
      &::before{
        content: '¥';
        font-size: 12px;
        font-weight: normal;
        margin-right: 3px;
      }
    }
    .org-price{
      flex: 1;
      font-size: 12px;
      color: #A8B0C5;
      text-decoration:line-through;
    }
  }
  .icon-return{
    margin-bottom: 10px;
    padding: 4px 10px;
    width: 55px;
    line-height: 1;
    font-size: 10px;
    color: #7D8091;
    text-align: center;
    background: rgba(52, 54, 64, .1);
    border: 1px solid rgba(52, 54, 64, .1);
    border-radius: 6px;
  }
}
</style>
